package com.b511.swpu.cementbackend.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import javax.validation.constraints.Min;
import java.util.Date;
import java.util.List;

@Entity
@Getter
@Setter
@EqualsAndHashCode
@Accessors(chain = true)
//井眼表
// TODO DELETE FAIL
public class Borehole extends CementBaseEntity {

    @Column(length = 100)
    private String wellName;

    @Column(length = 20)
    private String wellCategory;

    @Column(length = 20)
    private String wellType;

    @Column(length = 100)
    private String nationality;

    @Column(length = 100)
    private String block;

    @Column(length = 50)
    private String coordX;

    @Column(length = 50)
    private String coordY;

    @Column(length = 50)
    private String longitude;

    @Column(length = 50)
    private String latitude;

    @Column(length = 200)
    private String geographicalLocation;

    @Column(length = 200)
    private String structureLocation;

    @Column(length = 200)
    private String lineLocation;

    @Column(length = 50)
    private String zeroLocation;

    private Double turnPlate;

    private Double waterDepth;

    @Column(length = 50)
    private String drillingStratum;

    @Column(length = 50)
    private String mainObjStratum;

    @Column(length = 200)
    private String drillingPrinciple;

    @Column(length = 50)
    private String platform;

    @Temporal(TemporalType.DATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginDrillDate;

    @Temporal(TemporalType.DATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endDrillDate;

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "borehole", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<BurstPressure> burstPressures;

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "borehole", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<PorePressure> porePressures;

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "borehole", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<Stratum> strata;

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "borehole", cascade = {CascadeType.REMOVE})
    @JsonIgnore
    private List<WellBoreStructure> wellBoreStructures;

}
